package atm;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 查询界面
 */
public class SearchPanel extends  JPanel implements ActionListener {
    private ATMFrame atmFrame;
    private ImageIcon sureImg = new ImageIcon("images/buttonSure.jpg");
    private JButton sureBtn = new JButton(sureImg);
    private JLabel sumLabel = new JLabel();
    private Font font = new Font("黑体", Font.BOLD, 30);

    public SearchPanel(ATMFrame atmFrame) {
        this.atmFrame =  atmFrame;
        this.setLayout(null);
        sumLabel.setBounds(300,200,300,50);
        sumLabel.setFont(font);
        sureBtn.setBounds(884,240,140,50);
        this.add(sumLabel);
        this.add(sureBtn);
        sureBtn.addActionListener(this);
        this.setOpaque(false);
    }
    public void sum(){
        sumLabel.setText("卡上余额为" + atmFrame.getLoginUser().getBlance());
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        if(e.getSource() == sureBtn){
            atmFrame.switchPanel("menu");
        }
    }
}
